from Holiday import Holiday


class WeekdayHoliday (Holiday):
    '''
    Class to represent holidays that happen on the same weekday (typically a weekend)
    '''

    daynames = \
        [
        "Mon",
        "Tue",
        "Wed",
        "Thu",
        "Fri",
        "Sat",
        "Sun"
        ]
        
    def __init__ (self, description, dayofweek):
        Holiday.__init__(self, description)
        self.dayofweek = dayofweek
        
    def __repr__(self):
        return "<WeekdayHoliday(%d)>" % self.dayofweek

    def isholiday (self, when):
        return when.weekday() == self.dayofweek
    
    def text (self):
        return WeekdayHoliday.daynames[self.dayofweek]
    
    def type ():
        return "Weekday"
    
    type = staticmethod (type)
    
    @staticmethod
    def Monday ():
        return WeekdayHoliday ("Monday", 0)
    
    @staticmethod
    def Tuesday ():
        return WeekdayHoliday ("Tuesday", 1)
    
    @staticmethod
    def Wednesday ():
        return WeekdayHoliday ("Wednesday", 2)
    
    @staticmethod
    def Thursday ():
        return WeekdayHoliday ("Thursday", 3)
    
    @staticmethod
    def Friday ():
        return WeekdayHoliday ("Friday", 4)
    
    @staticmethod
    def Saturday ():
        return WeekdayHoliday ("Saturday", 5)
    
    @staticmethod
    def Sunday ():
        return WeekdayHoliday ("Sunday", 6)